<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Father {
            constructor(addressl, age) {
                this.addressl = addressl
                this.age = age
            }
            play() {
                console.log('father 喜欢看报纸');
            }
        }

        class Son extends Father {
            //  1. 对父类的方法进行了重写  override 
            play() {
                console.log('Son 喜欢打游戏');
            }
            // 2. 子类扩展了自己特有的方法
            ball() {
                console.log('son 喜欢打网球');
            }
        }

        let s = new Son('开封', 16)
        console.log(s);  //  addressl 开封   age 16
        s.play()  // Son 喜欢打游戏
        s.ball()  // son 喜欢打游戏
    </script>
</body>

</html>